package hn.cch.spring.bean.aware;

import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.support.GenericApplicationContext;

public class AwareApplication {
    public static void main(String[] args) {
        GenericApplicationContext applicationContext = new GenericApplicationContext();
        applicationContext.registerBean("beanNameAwareImpl", BeanNameAwareImpl.class);
        applicationContext.registerBean("initializingBeanImpl", InitializingBeanImpl.class);
        applicationContext.registerBean("awareConfiguration", AwareConfiguration.class);


        applicationContext.registerBean(AutowiredAnnotationBeanPostProcessor.class); // @Autowired @Value
        applicationContext.registerBean(CommonAnnotationBeanPostProcessor.class); // @Resource @PostConstruct @PreDestroy
        applicationContext.registerBean(ConfigurationClassPostProcessor.class);// @ComponentScan @Bean @Import @ImportResource

        applicationContext.refresh();

        applicationContext.close();
    }

}
